package com.qf.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsRegion;
import com.qf.service.AdminFegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;


@Service
public class AdminFegionServiceImpl implements AdminFegionService {

    @Autowired
    private DtsRegionMapper dtsRegionMapper;

    @Override
    public IPage<DtsRegion> selectRegionList(Integer page, Integer limit, String name, Integer code) {

        Page<DtsRegion> iPage = new Page<>(page, limit);

        QueryWrapper<DtsRegion> wrapper = new QueryWrapper<>();
        wrapper.like(!StringUtils.isEmpty(name), "name", name);
        wrapper.eq(code!= null, "code", code);

        IPage<DtsRegion> result = dtsRegionMapper.selectPage(iPage, wrapper);

        return result;
    }
}
